//package org.redis;
//
//import org.springframework.beans.factory.annotation.Value;
//import redis.clients.jedis.JedisPoolConfig;
//
//import java.time.Duration;
//
//public class RedisFactory {
//
//    @Value("${redis.evictTtlInMs:60000}")
//    private int evictTtlInMs;
//
//    @Value("${redis.pool_config.maxTotal:128}")
//    private int maxTotal;
//
//    @Value("${redis.pool_config.maxIdle:128}")
//    private int maxIdle;
//
//    @Value("${redis.pool_config.minIdle:16}")
//    private int minIdle;
//
//    @Value("${redis.pool_config.testOnBorrow:true}")
//    private boolean testOnBorrow;
//
//    @Value("${redis.pool_config.testOnReturn:true}")
//    private boolean testOnReturn;
//
//    @Value("${redis.pool_config.testWhileIdle:true}")
//    private boolean testWhileIdle;
//
//    @Value("${redis.pool_config.minEvictableMs:60000}")
//    private long minEvictableMs;
//
//    @Value("${redis.pool_config.evictionRunsMs:30000}")
//    private long evictionRunsMs;
//
//    @Value("${redis.pool_config.maxWaitMills:60000}")
//    private long maxWaitMills;
//
//    @Value("${redis.pool_config.numberTestsPerEvictionRun:3}")
//    private int numberTestsPerEvictionRun;
//
//    @Value("${redis.pool_config.blockWhenExhausted:true}")
//    private boolean blockWhenExhausted;
//
//
//    protected JedisPoolConfig buildPoolConfig() {
//        final JedisPoolConfig poolConfig = new JedisPoolConfig();
//        poolConfig.setMaxTotal(maxTotal);
//        poolConfig.setMaxIdle(maxIdle);
//        poolConfig.setMinIdle(minIdle);
//        poolConfig.setTestOnBorrow(testOnBorrow);
//        poolConfig.setTestOnReturn(testOnReturn);
//        poolConfig.setTestWhileIdle(testWhileIdle);
//        poolConfig.setSoftMinEvictableIdleTime(Duration.ofMillis(minEvictableMs));
//        poolConfig.setTimeBetweenEvictionRuns(Duration.ofMillis(evictionRunsMs));
//        poolConfig.setMaxWaitMillis(maxWaitMills);
//        poolConfig.setNumTestsPerEvictionRun(numberTestsPerEvictionRun);
//        poolConfig.setBlockWhenExhausted(blockWhenExhausted);
//        return poolConfig;
//    }
//
//}
